<%@ Page Language="C#" Inherits="Castle.MonoRail.Views.AspView.ViewAtDesignTime" %>
<%@ import namespace="Castle.MonoRail.Framework" %>
<%@ import namespace="System.Collections.Generic" %>
<%@ import namespace="${Rails.Model.Namespace}.Models" %>
<%@ import namespace="${Rails.Model.Namespace}.Controllers.Database" %>
<%@ import namespace="${Rails.Model.Namespace}.Controllers.Helpers" %>
<%@ import namespace="${Rails.Model.Namespace}.Controllers.Resources" %>
<aspView:properties>
<% 
I${Rails.Entity.ClassName} ${Rails.Entity.ClassName.ToLower()};
Site CurrentSite;
AbstractBaseSmartDispatchController CurrentController; 
MenuHelper MenuHelper;
CustomHtmlHelper CustomHtmlHelper; 
${Rails.Entity.ClassName}Helper ${Rails.Entity.ClassName}Helper;
%>
</aspView:properties>
<component:MessagesComponent>
</component:MessagesComponent>
<% if (Properties.ContainsKey("${Rails.Entity.ClassName.ToLower()}")) {
  List<String> qstring = new List<String>();
%>

#foreach($attribute in $Rails.Entity.Attributes)
#if($attribute.IsPkColumn)
<% qstring.Add("${attribute.DotNetName}" + "=" + ${Rails.Entity.ClassName.ToLower()}.${attribute.DotNetName} ); %>
#end
#end
<table class="table1">
	<thead>
		<tr>
			<th colspan="2"><%= String.Format(CommonResource.Detail, ${Rails.Entity.ClassName}Resource.${Rails.Entity.ClassName}, ${Rails.Entity.ClassName.ToLower()} ) %></th>
		</tr>
	</thead>
	<tbody>
#foreach($attribute in $Rails.Entity.Attributes)
#if($attribute.Display)
  <tr>
    <th class="sub"><%= ${Rails.Entity.ClassName}Resource.${attribute.DotNetName} %></th>
    <td>$HtmlHelpers.GenerateControlReadOnly($Rails.Entity, $attribute)</td>
  </tr>
#end
#end
</tbody>
</table>
<p>
	<%=MenuHelper.CreateCancelLink()%>&nbsp;|&nbsp;<%=MenuHelper.CreateEditLink(MenuHelper.Join(qstring, "&amp;"))%>&nbsp;|&nbsp;<%=MenuHelper.CreateDeleteLink(MenuHelper.Join(qstring, "&amp;"))%>
</p>
#foreach($relation in $Rails.Entity.ToManyRelationships)
<p>$relation.DotNetName</p>
<ul>
<% foreach (${relation.ForeignEntity.ClassName} related in ${Rails.Entity.ClassName.ToLower()}.${relation.VarName}) { %>
<li><%= related %></li>
<% } %>
</ul>
#end

<% } %>
